﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RMS.Utils.Dicom.Commen
{

    public class CharacterRepertoire
    {
        private static  System.Text.Encoding encoding = null;
        public static System.Text.Encoding Encoding
        {
            get
            {
                if (encoding != null)
                    return encoding;
                else
                    return System.Text.Encoding.ASCII;
            }
        }
        public static void characterRepertoire(string characterSet)
        {
            if (characterSet == null) characterSet = "";
            characterSet = characterSet.ToUpper()
                .Replace(" ", null)
                .Replace("-", null)
                .Replace("_", null);
            switch (characterSet)
            {
                case "":
                case "ISOIR6":
                case "ASCII":
                    encoding = System.Text.Encoding.ASCII;
                    break;
                case "ISOIR100":
                case "ISO88591":
                    encoding =
                        System.Text.Encoding.GetEncoding("ISO-8859-1");
                    break;
                case "ISOIR101":
                case "ISO88592":
                    encoding =
                         System.Text.Encoding.GetEncoding("ISO-8859-2");
                    break;
                case "ISOIR109":
                case "ISO88593":
                    encoding =
                        System.Text.Encoding.GetEncoding("ISO-8859-3");
                    break;
                case "ISOIR110":
                case "ISO88594":
                    encoding =
                        System.Text.Encoding.GetEncoding("ISO-8859-4");
                    break;
                case "ISOIR144":
                case "ISO88595":
                    encoding =
                        System.Text.Encoding.GetEncoding("ISO-8859-5");
                    break;
                case "ISOIR127":
                case "ISO88596":
                    encoding =
                        System.Text.Encoding.GetEncoding("ISO-8859-6");
                    break;
                case "ISOIR126":
                case "ISO88597":
                    encoding =
                        System.Text.Encoding.GetEncoding("ISO-8859-7");
                    break;
                case "ISOIR138":
                case "ISO88598":
                    encoding =
                        System.Text.Encoding.GetEncoding("ISO-8859-8");
                    break;
                case "ISOIR148":
                case "ISO88599":
                    encoding =
                        System.Text.Encoding.GetEncoding("ISO-8859-9");
                    break;
                case "ISOIR192":
                case "UTF8":
                    encoding = System.Text.Encoding.UTF8;
                    break;
                default:
                    encoding = null;
                    break;
            }
        }
    }
}
